package com.qidian.mes.defect.controller;

import com.qidian.mes.defect.service.DetectionItemService;
import com.qidianit.common.pojo.MESResult;
import com.qidianit.mes.pojo.DetectName;
import com.qidianit.mes.pojo.Incoming;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Author 泽华
 * @Description
 * @Time 2024-10-22 23:04
 */
@RestController
@CrossOrigin
@RequestMapping("/detectItem")

public class DetectionItemController {
    @Autowired
    private DetectionItemService detectionItemService;
    @GetMapping("/list")
    public MESResult list(String detectionName,
                          String detectionType,
                          String detectionTool,
                          String detectionMethod,
                          String standardValue,
                          String unit,
                          Long errorCap,
                          Long errorLow,
                          @RequestParam(defaultValue = "1")int page,
                          @RequestParam(defaultValue = "10") int limit){
        return detectionItemService.list(
                detectionName,
                detectionType,
                detectionTool,
                detectionMethod,
                standardValue,
                unit,
                errorCap,
                errorLow,
                page,
                limit);
    }

    @PostMapping("/save")
    public MESResult save(@RequestBody DetectName detectName){
        return detectionItemService.save(detectName);
    }

    @PutMapping("/update")
    public MESResult update(@RequestBody DetectName detectName){
        return detectionItemService.update(detectName);
    }
    //通过id查询这条数据
    @GetMapping("/get")
    public MESResult get(Long detectionId){
        return detectionItemService.selectById(detectionId);
    }


}
